<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<div id="page-content">
    <div class="row">

        <div class="col-lg-12">
            <div class="panel">
                <div class="panel-heading">
                    <h3 class="panel-title">资产调拨</h3>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <div class="row">
                            <div class="col-sm-12 table-toolbar-left">
                                <btn id="btn_add_assetflit" class="btn btn-primary btn-sm">
                                    <i class="ti-plus"> </i> 新建资产调拨登记表
                                </btn>
                            </div>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table id="assetflit_apply_table"></table>
                        <div id="assetflit_apply_page"></div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<script>

    $(function(){

        init_grid_assetflit();

    });

    function init_grid_assetflit() {
//年    月     资产编号    资产名称     原使用人   现使用人       调拨日期      调拨状态
        __init_jqgrid('assetflit_apply_table', 'assetflit_apply_page',
                '<%=path%>/activiti/assetflit/list',
                ['年', '月', '资产编号','资产名称','原使用人', '现使用人','调拨日期', '调拨状态', '操作', 'id'],
                [
                    {name: 'year', index: 'year', width: 40, sortable: true, search: false},
                    {name: 'month', index: 'month', width: 30, sortable: true, search: false},
                    {name: 'assetNo', index: 'assetNo', width: 80, sortable: false, search: false},
                    {name: 'name', index: 'name', width: 80, sortable: true, search: false},
                    {name: 'oldUserName', index: 'oldUserName', width: 40, sortable: false, search: false},
                    {name: 'user', index: 'user', width: 40, sortable: false, search: false},
                    {name: 'dateApply', index: 'dateApply', width: 40, sortable: false, search: false},
                    {name: 'txtStatus', index: 'txtStatus', width: 40, sortable: false, search: false},
                    {name: 'act', index: 'act', width: 150, fixed: true, sortable: false, search: false, formatter: actFormat},
                    {name: 'id', index: 'id', width: 100, key: true, hidden: true, hidedlg: true}
                ],
                true,
                {
                    postData: {catalog: 0x03}
                }
        );

    }

    function actFormat(cellvalue, options, rowObject){
        var id = rowObject.id;
        cellvalue = '<button class="btn btn-white btn-sm" data-original-title="查看" onclick="fn_assetflit_read(\'' + id + '\');"><i class="fa fa-eye"> </i> 查看</button>';

        return cellvalue;
    }

    function fn_assetflit_read(id) {
        loadURL('<%=path%>/activiti/assetflit/read/'+id, $('#page-content'));
    }

    $("#btn_add_assetflit").click(function(){
        loadURL('<%=path%>/activiti/assetflit/create', $('#page-content'));
    });
</script>